﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FineSoft.Models
{
	public class ArrayClass : Class
	{
		public int ElementClassIndex;
		private Class _ElementClass;
		public Class ElementClass
		{
			get
			{
				if (this._ElementClass == null)
				{
					if (InitialData.Classes == null)
						return null;
					this._ElementClass = InitialData.Classes[this.ElementClassIndex];
				}
				return this._ElementClass;
			}
		}

		public override string Name
		{
			get
			{
				if (base.Name == null)
				{
					if (this.ElementClass == null)
						return "";
					base.Name = this.ElementClass.Name + "[]";
				}
				return base.Name;
			}
			set
			{
				base.Name = value;
			}
		}

		private string[] _AlternateNames;
		public string[] AlternateNames
		{
			get
			{
				if (this._AlternateNames == null)
				{
					if (this.ElementClass == null || !(this.ElementClass is ExtClass))
						return new string[0];
					this._AlternateNames = ((ExtClass)this.ElementClass).AlternateNames.Select(n => n + "[]").ToArray();
				}
				return this._AlternateNames;
			}
		}
	}
}